import 'package:json_annotation/json_annotation.dart';

part 'stages.g.dart';

@JsonSerializable()
class CheckpointStages {
  final int isVIP;
  final String desc;
  final String dungeonPic;
  final String dungeonId;
  final String dungeonName;
  final int vipExtra;
  final List<CheckpointStageList> stageList;

  CheckpointStages(
      {this.isVIP,
      this.desc,
      this.dungeonPic,
      this.dungeonId,
      this.dungeonName,
      this.vipExtra,
      this.stageList});

  factory CheckpointStages.fromJson(Map<String, dynamic> json) =>
      _$CheckpointStagesFromJson(json);

  Map<String, dynamic> toJson() => _$CheckpointStagesToJson(this);
}

@JsonSerializable()
class CheckpointStageList {
  final ConfigInfo configInfo;
  final UsrInfo usrInfo;

  CheckpointStageList({this.configInfo, this.usrInfo});

  factory CheckpointStageList.fromJson(Map<String, dynamic> json) =>
      _$CheckpointStageListFromJson(json);

  Map<String, dynamic> toJson() => _$CheckpointStageListToJson(this);
}

@JsonSerializable()
class ConfigInfo {
  final String stageId;
  final String dungeonId;
  final String bossname;
  final int dailynum;
  final int vipnum;
  final int vitality;
  final String desc;

  ConfigInfo(
      {this.stageId,
      this.dungeonId,
      this.bossname,
      this.dailynum,
      this.vipnum,
      this.vitality,
      this.desc});

  factory ConfigInfo.fromJson(Map<String, dynamic> json) =>
      _$ConfigInfoFromJson(json);

  Map<String, dynamic> toJson() => _$ConfigInfoToJson(this);
}

@JsonSerializable()
class UsrInfo {
  final int leftNum;
  final bool unlocked;
  final StageGrade stageGrade;

  UsrInfo({this.leftNum, this.unlocked, this.stageGrade});

  factory UsrInfo.fromJson(Map<String, dynamic> json) =>
      _$UsrInfoFromJson(json);

  Map<String, dynamic> toJson() => _$UsrInfoToJson(this);
}

@JsonSerializable()
class StageGrade {
  ///评分等级
  final int grade;

  ///最高分
  final int score;

  StageGrade({this.grade, this.score});

  factory StageGrade.fromJson(Map<String, dynamic> json) =>
      _$StageGradeFromJson(json);

  Map<String, dynamic> toJson() => _$StageGradeToJson(this);
}
